package controllers;

import play.*;
import play.i18n.Messages;
import play.mvc.*;

import java.util.*;

import models.*;

public class Application extends Controller {

	public static void index() {
		groups();
	}

	public static void groups() {
		List<Group> groups = Group.find("order by orderPlace asc").fetch();
		render(groups);
	}
	
	public static void group(Long id) {
		Group group = Group.findById(id);
		List<Print> prints = Print.findAllEnabledByGroup(group.groupId);
		prints = Print.findAll();//TODO remove
		render(prints, group);
	}
	
	public static void print(Long groupId, Long printId) {
		index();//TODO
	}
	
	@Before
    static void addDefaults() {
        renderArgs.put("shopTitle", Messages.get("shop.title"));
        renderArgs.put("shopBaseline", Messages.get("shop.baseline"));
    }
}